<HTML>
<head>
<title>AngelScript: Reference: asIScriptStruct</title>
<LINK rel="stylesheet" type="text/css" href="style.css">
</head>

<body>

<p>
<a href="../index.html">index</a>
</p>

<h1>Reference: asIScriptStruct</h1>

<pre class=border>
class asIScriptStruct
{
public:
  <font color=green>// Memory management</font>
  int <a href="#addref">AddRef</a>();
  int <a href="#release">Release</a>();

  <font color=green>// Struct type</font>
  int <a href="#gettypeid">GetStructTypeId</a>();

  <font color=green>// Struct properties</font>
  int <a href="#propcount">GetPropertyCount</a>();
  int <a href="#proptype">GetPropertyTypeId</a>(asUINT prop);
  const char *<a href="#propname">GetPropertyName</a>(asUINT prop);
  void *<a href="#propptr">GetPropertyPointer</a>(asUINT prop);
  int <a href="#copyfrom">CopyFrom</a>(asIScriptStruct *other);
};
</pre>



<a name=addref></a>
<h2>AddRef</h2>

<pre class=border>
int AddRef();
</pre>

<h3>Description</h3>

<p>This method increases the internal reference counter of the object and
returns the count. The returned value shouldn't be used for anything else
but debugging.</p>

<p>Call AddRef() each time you assign a reference to a new variable.</p>

<h3>Returns</h3>

<p>The internal reference counter.</p>












<a name=release></a>
<h2>Release</h2>

<pre class=border>
int Release();
</pre>

<h3>Description</h3>

<p>Decreases the internal reference counter and returns the count. If the
counter reaches 0 the object is deleted and the memory is freed.</p>

<p>After calling Release() don't forget to set your reference to 0 so that
you don't mistakenly try to use the reference again.</p>

<h3>Returns</h3>

<p>The internal reference counter.</p>






<a name=gettypeid></a>
<h2>GetStructTypeId</h2>

<pre class=border>
int GetStructTypeId();
</pre>

<h3>Description</h3>

<p>Returns the type id of the script structure.</p>

<h3>Returns</h3>

<p>The type id.</p>






<a name=propcount></a>
<h2>GetPropertyCount</h2>

<pre class=border>
int GetPropertyCount();
</pre>

<h3>Description</h3>

<p>Use this method to determine how many properties this structure has.</p>

<h3>Returns</h3>

<p>The number of properties.</p>






<a name=proptype></a>
<h2>GetPropertyTypeId</h2>

<pre class=border>
int GetPropertyTypeId(asUINT prop);
</pre>

<h3>Description</h3>

<p>Use the returned type id, to determine how to handle the property pointer.</p>

<h3>Parameters</h3>

<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=100><code>prop</code>&nbsp;</td>
<td valign=top><p>The zero based index of the property of interest.</p></td>
</tr>
</table>

<h3>Returns</h3>

<p>If the index is within range, then the method returns the type id of the property, otherwise the value will be negative.</p>





<a name=propname></a>
<h2>GetPropertyName</h2>

<pre class=border>
const char *GetPropertyName(asUINT prop);
</pre>

<h3>Description</h3>

<p>The method returns a string with the name of the property as declared in the script.</p>

<h3>Parameters</h3>

<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=100><code>prop</code>&nbsp;</td>
<td valign=top><p>The zero based index of the property of interest.</p></td>
</tr>
</table>

<h3>Returns</h3>

<p>A pointer to the string, or null if out of range.</p>






<a name=propptr></a>
<h2>GetPropertyPointer</h2>

<pre class=border>
void *GetPropertyPointer(asUINT prop);
</pre>

<h3>Description</h3>

<p>The method returns a pointer to the memory location for the property. Use the type id for the property to determine the content of the pointer, and how to handle it.</p>

<h3>Parameters</h3>

<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=100><code>prop</code>&nbsp;</td>
<td valign=top><p>The zero based index of the property of interest.</p></td>
</tr>
</table>

<h3>Returns</h3>

<p>A pointer to the property.</p>





<a name=copyfrom></a>
<h2>CopyFrom</h2>

<pre class=border>
int CopyFrom(asIScriptStruct *other);
</pre>

<h3>Description</h3>

<p>This method copies the contents of the other object to this one.</p>

<h3>Parameters</h3>

<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top width=100><code>other</code>&nbsp;</td>
<td valign=top><p>A pointer to the other struct object.</p></td>
</tr>
</table>

<h3>Returns</h3>

<p>A negative value on error.</p>




<p><a href="#">top</a></p>

</body></HTML>